package shooter;

import java.io.File;
import java.io.FilenameFilter;

/**
 * FileExtensionFilter is a filter for files with a special ending.
 * 
 * @author Michail Tausch
 */
public class FileExtensionFilter implements FilenameFilter{
	
	private String ext="*";
	
	/**
	 * The Constructor of this class. It only works with a String
	 * which should be the ending of each file.
	 */
	public FileExtensionFilter(String ext){
		this.ext = ext;
	}
	
	/**
	 * Returns true if File dir has the specific ending.
	 */
	public boolean accept(File dir, String name){
		if (name.endsWith(ext))
			return true;
		return false;
	}
}